package com.shunwang.errors.engine.util;

import com.shunwang.errors.engine.exception.BussException;

public class ThrowableUtil {

	public static String getFirstThrowable(Throwable throwable){
		if(throwable instanceof BussException){
			StackTraceElement e = throwable.getStackTrace()[0];
			return e.getClassName()+"."+e.getMethodName();
		}
		return null;
	}
	
	public static void hasBussException(Throwable throwable){
		if(!(throwable instanceof BussException)){
			throw new IllegalArgumentException(throwable.getClass().getName()+" must extends BussException");
		}
	}
}
